package com.swjd.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import com.swjd.pojo.Home;
import com.swjd.pojo.User;
import com.swjd.service.IHomeService;
import com.swjd.service.IUserService;

@Controller
public class UserController {

	@Autowired
	private IUserService service;
	
	@RequestMapping("getcheck.do")
	public ModelAndView getCheck(@RequestParam("username") String username,@RequestParam("password") String password){
		ModelAndView mv = new ModelAndView();
        User user = service.checkUsers(username, password);
		if (user != null) {
            mv.addObject("user", user);
            mv.setViewName("begin.jsp");
        }else {
            mv.setViewName("login.jsp");
        }return mv;
    }
		
}
